@model ZKEACMS.FormGenerator.Models.FormField
@{
    string maxLength = "10";
    Model.Attributes.TryAdd("data-val-length", L("{0}的长度应小于{1}").Text.FormatWith(Model.DisplayName, maxLength));
    Model.Attributes.TryAdd("data-val-length-max", maxLength);
}
@*field-validation-valid*@
<div class="input-group input-group-icon">
    @Html.TextBox(Model.ID, Model.Value, Model.Attributes)
    <span class="small-fixed" data-valmsg-for="@Model.ID" data-valmsg-replace="true"></span>
    <span class="input-group-addon p-5" style="width:20%;">
        <img src="@Url.Content("~/Validation/code")" id="getcode" title="看不清？点击更换验证码" align="middle" />
    </span>
    @if (Model.Description.IsNotNullAndWhiteSpace())
    {
        <dl>
            <dd>
                @Model.Description
            </dd>
        </dl>
    }
</div>
<script type="text/javascript">
    $('#getcode').click(function () {
        var urls = this.src.split('?');
        var rand = Math.random();
        this.src = urls[0] + '?r=' + rand;
    });
</script>
